﻿using System.Diagnostics.Contracts;

namespace OpenLS.Spreadsheet.Formats.Biff.OfficeArt
{
    internal class OfficeArtFDG: OfficeArtRecord
    {
        private uint csp;
        private uint spidCur;

        public OfficeArtFDG(uint count, uint spId)
        {
            this.csp = count;
            this.spidCur = spId;
        }

        public OfficeArtFDG()
        {
        }

        public override RecType RecordType
        {
            get { return RecType.OfficeArtFDG; }
        }


        protected override void ReadNoHeader(OfficeArtReadContext context)
        {
            Contract.Assert(rhrecInstance <= 0xFFE);
            Contract.Assert(rhrecVer == 0x0);
            Contract.Assert(rhrecType == (RecType) 0xF008);
            Contract.Assert(rhrecLen == 0x00000008);
            csp = context.ReadUInt32();
            spidCur = context.ReadUInt32(); //MSOSPID  == uint
        }

        protected override byte Version
        {
            get { return 0x0; }
        }

        protected override int ByteLength
        {
            get { return 8; }
        }


        protected override void WriteNoHeader(OfficeArtWriteContext context)
        {
            Contract.Assert(rhrecInstance <= 0xFFE);
            Contract.Assert(rhrecVer == 0x0);
            Contract.Assert(rhrecType == (RecType)0xF008);
            Contract.Assert(rhrecLen == 0x00000008);
            context.Write(csp);
            context.Write(spidCur);
        }

        protected override void PrepareHeader(ref OfficeArtRecordHeader rh)
        {
            rh.recLen = 0x08;
        }

    }
}